/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#pragma once

#include "向量.h"
#include "core/空间划分/球形八叉树.h"

#include <map>
#include "PBF_GPU数据.h"




struct S_PDB数据 {
	std::vector<vec3>		m_位置;
	std::vector<vec3>		m_外力;
	std::vector<vec3>		m_加速度;		//Acceleration
	std::vector<vec3>		m_速度;
	

	std::vector<uint32>		m_物理体ID;
	std::vector<uint8>		m_物理体类型;
	std::vector<float32>	m_Lambda;
	std::vector<float32>	m_质量;
	std::vector<float32>	m_密度;
	float32					m_密度0;

	vec3					m_重力;

	std::vector<vec3>		m_位置量变化;
	std::vector<vec3>		m_上一帧位置;


	float32					m_粒子半径;
	uint64					m_流体粒子总数;
	float32					m_粘度;




	//float32					m_内核因子;
	//float32					m_光滑长度;
	float32					m_粒子光滑半径;
	uint32					m_飞溅粒子数量;


	S_点距八叉树*			m_静态网格空间划分;
	std::vector<vec3>		m_静态三角网格顶点;
	std::vector<uvec3>		m_静态三角网格索引;



	//============================== GPU数据 ==================================
	S_PBF_Gpu				m_GPU数据;


	//========================================================================================================
	//std::vector<vec3>		m_方向;											//????????
	//std::vector<vec3>		m_计算后位置;

	/*std::vector<vec3>		m_固定粒子;
	std::vector<float32>	m_固定粒子磅力;

	std::vector<uint32*>					m_动态邻接粒子索引;
	std::vector<uint8>						m_动态邻接数量;
	std::vector<uint32*>					m_静态邻接粒子索引;
	std::vector<uint8>						m_静态邻接数量;
	std::map<uint32, std::vector<uint32>>	m_邻接单元格;
	std::vector<uint32>						m_动态邻接索引;
	std::vector<uint32>						m_静态邻接索引;

	float32					mIR_密度0;
	uint64					m_静态粒子总数;
	float32					m_步进时间;
	
	float32					m_域单元大小;
	uint32					m_邻接最大粒子数;
	*/


	



	S_PDB数据();
	~S_PDB数据();
	
	//float32		f_光滑内核(const vec3& p);
	vec3		f_梯度内核(const vec3& p);

	void		f_动态粒子重置(uint64 num);
	void		f_静态粒子重置(uint64 num);





	void		f_resize(uint64 num, bool 是否分配GPU);
	void		f_初始数据到GPU();
	void		f_数据到GPU();
	void		f_数据到CPU();
	uint64		f_size();

	
};











